<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>

<body onload="reurl()">

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    </ul>
    </div>

	<div class="mainindex">


		<div class="welinfo">
			<span><img src="images/sun.png" alt="天气" /></span> <i id="timeValue"></i>
		</div>

		<div class="welinfo">
			<span><img src="images/time.png" alt="时间" /></span><i id="time"></i>
		</div>

		<div class="xline"></div>
		<div class="leftinfo">
			<div class="listtitle">
				<a href="#" class="more1"></a>数据统计
			</div>

			<div class="maintj">
				<table id='myTable5'>
					<caption>二维码类型占比图</caption>
					<thead>
						<tr>
							<th></th>
							<th>文本类型</th>
							<th>坐标类型</th>
							<th>网址类型</th>
						</tr>
					</thead>
					<tbody id="chatBody">
						<tr>
							<th></th>
							<td id="textcount"></td>
							<td id="poscount"></td>
							<td id="webcount"></td>
							</tr>
					</tbody>
				</table>
			</div>

			</div>
			
			
					<div class="leftinfo">
			<div class="listtitle">
				<a href="#" class="more1"></a>信息统计
			</div>

		
					<ul class="newlist">
						<li><i>用户数：</i><p id="userCount"></p></li>
						<li><i>人员数：</i><p id="personCount"></p></li>
						<li><i>二维码数：</i><p id="qrCount"></p></li>
					</ul>


			</div>




<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jsapi.js"></script>
<script type="text/javascript" src="js/format+zh_CN,default,corechart.I.js"></script>		
<script type="text/javascript" src="js/jquery.gvChart-1.0.1.min.js"></script>
<script type="text/javascript" src="js/jquery.ba-resize.min.js"></script>
<script type="text/javascript">
	//进入首页时，刷新当前页面
	function reurl() {
	    url = location.href; //把当前页面的地址赋给变量 url
	    var times = url.split("?"); //分切变量 url 分隔符号为 "?"
	    if (times[1] != 1) { //如果?后的值不等于1表示没有刷新
	        url += "?1"; //把变量 url 的值加入 ?1
	        self.location.replace(url); //刷新页面
	    }
	}  
gvChartInit();
jQuery(document).ready(function(){

jQuery('#myTable5').gvChart({
		chartType: 'PieChart',
		gvSettings: {
			vAxis: {title: 'No of players'},
			hAxis: {title: 'Month'},
			width: 650,
			height: 250
			}
	});
});

	setWidth();
	
	$(window).resize(function(){
		setWidth();	
	
	});
	function setWidth(){
		var width = ($('.leftinfos').width()-12)/2;
		$('.infoleft,.inforight').width(width);
	}
	//根据类型获取二维码记录数用于图表展示
  	$.post("/Servicing/qr/getQrByType",function(data){
	
    	 $.each(data,function(key,value){
			
			var textcount=value.qrTextCount;
			var poscount=value.qrPosCount;
			var webcount=value.qrWebCount;
    		 window.sessionStorage.textcount=textcount;
    		 window.sessionStorage.poscount=poscount;
    		 window.sessionStorage.webcount=webcount;
    	 })
   	})  
	//获取用户记录数
	$.get("/webmanager/user/findUserCount",function(data){
    	 $('#userCount').text(data);
    	 
   	})
   	//获取人员总记录数
   	$.get("/Servicing/person/getPersonCount",function(data){
    	 $('#personCount').text(data);
   	})
   	//获取二维码记录数
   		$.get("/Servicing/qr/getQrCount",function(data){
    	 $('#qrCount').text(data);
   	})
   	//获取系统时间
var newDate = '';
getLangDate();
//值小于10时，在前面补0
function dateFilter(date){
    if(date < 10){return "0"+date;}
    return date;
}
   	//当前时间
function getLangDate(){
    var dateObj = new Date(); //表示当前系统时间的Date对象
    var year = dateObj.getFullYear(); //当前系统时间的完整年份值
    var month = dateObj.getMonth()+1; //当前系统时间的月份值
    var date = dateObj.getDate(); //当前系统时间的月份中的日
    var day = dateObj.getDay(); //当前系统时间中的星期值
    var weeks = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
    var week = weeks[day]; //根据星期值，从数组中获取对应的星期字符串
    var hour = dateObj.getHours(); //当前系统时间的小时值
    var minute = dateObj.getMinutes(); //当前系统时间的分钟值
    var second = dateObj.getSeconds(); //当前系统时间的秒钟值
    var timeValue = "" +((hour >= 12) ? (hour >= 18) ? "晚上" : "下午" : "上午" ); //当前时间属于上午、晚上还是下午
     newDate = dateFilter(year)+"-"+dateFilter(month)+"-"+dateFilter(date);
     newTime = dateFilter(hour)+":"+dateFilter(minute)+":"+dateFilter(second);
    //document.getElementById("nowTime").innerHTML =newTime; 
    //document.getElementById("nowDate").innerHTML =newDate;
    $("#timeValue").text("admin，您"+timeValue+"好，欢迎试用二维码管理系统");
    $("#time").text("当前时间："+newDate+" "+newTime);
    setTimeout("getLangDate()",1000);

}


	   		var textcounts=sessionStorage.getItem("textcount");
	   		var poscounts=sessionStorage.getItem("poscount");
	   		var webcounts=sessionStorage.getItem("webcount");	  
		   	$("#textcount").text(textcounts);
		   	$("#poscount").text(poscounts);
		   	$("#webcount").text(webcounts);
	 	
 
</script>
</body>
</html>
